package com.woniuxy.java106crm.controller;

import com.woniuxy.java106crm.annotation.RequireMethod;
import com.woniuxy.java106crm.request.ResponseResult;
import com.woniuxy.java106crm.service.StatisticAnalysisService;
import com.woniuxy.java106crm.vo.CustomerCompositionVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 *统计报表的控制类
 */
@Api(tags = "客户构成分析API文档")
@Slf4j
@RestController
@RequestMapping("/statisticAnalysis")
public class StatisticAnalysisController {

    @Resource
    private StatisticAnalysisService statisticAnalysisService;


    /**客户构成分析*/
    @RequireMethod("客户构成分析")
    @GetMapping("/getGradeAndNum")
    public ResponseResult<List<CustomerCompositionVo>> getGradeAndNum(){
        List<CustomerCompositionVo> gradeAndNum = statisticAnalysisService.getGradeAndNum();
//        System.out.println(gradeAndNum.toString());
        return new ResponseResult<>(ResponseResult.OK,gradeAndNum);
    }

}
